home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 23
/
AMIGAplus Sonderheft 23 (2000)(Falke)(DE)[!].iso
/
Updates
/
HD-Installer
/
-WHDLoad-
/
WHDLoad_dev
/
Include
/
whdload.i
Wrap
Text File
|
1999-11-08
|
16KB
|
563 lines
IFND WHDLOAD_I
WHDLOAD=1
IFND EXEC_EXECBASE_I
INCLUDE exec/execbase.i
ENDC
IFND EXEC_TYPES_I
INCLUDE exec/types.i
ENDC
IFND GRAPHICS_MODEID_I
INCLUDE graphics/modeid.i
ENDC
IFND HARDWARE_CIA_I
INCLUDE hardware/cia.i
ENDC
IFND HARDWARE_CUSTOM_I
INCLUDE hardware/custom.i
ENDC
IFND HARDWARE_INTBITS_I
INCLUDE hardware/intbits.i
ENDC
IFND HARDWARE_DMABITS_I
INCLUDE hardware/dmabits.i
ENDC
IFND UTILITY_TAGITEM_I
INCLUDE utility/tagitem.i
ENDC
;some custom stuff
BITDEF POTGO,OUTRY,15
BITDEF POTGO,DATRY,14
BITDEF POTGO,OUTRX,13
BITDEF POTGO,DATRX,12
BITDEF POTGO,OUTLY,11
BITDEF POTGO,DATLY,10
BITDEF POTGO,OUTLX,9
BITDEF POTGO,DATLX,8
BITDEF POTGO,START,0
_ciaa = $bfe001
_ciab = $bfd000
_custom = $dff000
;=============================================================================
; misc
;=============================================================================
SLAVE_HEADER MACRO
moveq #-1,d0
rts
dc.b "WHDLOADS"
ENDM
;=============================================================================
; some useful macros
;=============================================================================
****************************************************************
***** write opcode ILLEGAL to specified address
ill MACRO
IFNE NARG-1
FAIL arguments "ill"
ENDC
move.w #$4afc,\1
ENDM
****************************************************************
***** write opcode RTS to specified address
ret MACRO
IFNE NARG-1
FAIL arguments "ret"
ENDC
move.w #$4e75,\1
ENDM
****************************************************************
***** skip \1 instruction bytes on address \2
skip MACRO
IFNE NARG-2
FAIL arguments "skip"
ENDC
IFLE \1-126
move.w #$6000+\1-2,\2
ELSE
IFLE \1-32766
move.l #$60000000+\1-2,\2
ELSE
FAIL "skip: distance to large"
ENDC
ENDC
ENDM
****************************************************************
***** write \1 times opcode NOP starting at address \2
nops MACRO
IFNE NARG-2
FAIL arguments "nops"
ENDC
movem.l d0/a0,-(a7)
IFGT \1-127
move.w #\1-1,d0
ELSE
moveq #\1-1,d0
ENDC
lea \2,a0
.lp\@ move.w #$4e71,(a0)+
dbf d0,.lp\@
movem.l (a7)+,d0/a0
ENDM
****************************************************************
***** write opcode JMP \2 to address \1
patch MACRO
IFNE NARG-2
FAIL arguments "patch"
ENDC
move.w #$4ef9,\1
pea \2
move.l (a7)+,2+\1
ENDM
****************************************************************
***** write opcode JSR \2 to address \1
patchs MACRO
IFNE NARG-2
FAIL arguments "patchs"
ENDC
move.w #$4eb9,\1
pea \2
move.l (a7)+,2+\1
ENDM
****************************************************************
***** wait that blitter has finished his job
***** (this is adapted from graphics.WaitBlit, see autodocs for
***** hardware bugs and possible problems ...)
***** if \1 is given it must be an address register containing _custom
BLITWAIT MACRO
IFEQ NARG-1
tst.b (dmaconr,\1)
.waitb\@ tst.b (_ciaa) ;this avoids blitter slow down
tst.b (_ciaa)
btst #DMAB_BLTDONE-8,(dmaconr,\1)
bne.b .waitb\@
tst.b (dmaconr,\1)
ELSE
tst.b (_custom+dmaconr)
.waitb\@ tst.b (_ciaa) ;this avoids blitter slow down
tst.b (_ciaa)
btst #DMAB_BLTDONE-8,(_custom+dmaconr)
bne.b .waitb\@
tst.b (_custom+dmaconr)
ENDC
ENDM
****************************************************************
***** wait of vertical blank
***** if \1 is given it must be an address register containing _custom
waitvb MACRO
IFEQ NARG-1
.1\@ btst #0,(vposr+1,\1)
beq .1\@
.2\@ btst #0,(vposr+1,\1)
bne .2\@
ELSE
.1\@ btst #0,(_custom+vposr+1)
beq .1\@
.2\@ btst #0,(_custom+vposr+1)
bne .2\@
ENDC
ENDM
****************************************************************
***** wait for pressing any button
***** if \1 is given it must be an address register containing _custom
waitbutton MACRO
IFEQ NARG
move.l a0,-(a7)
lea (_custom),a0
.down\@ bsr .wait\@
btst #CIAB_GAMEPORT0,(ciapra+_ciaa) ;LMB
beq .up\@
btst #POTGOB_DATLY-8,(potinp,a0) ;RMB
beq .up\@
btst #CIAB_GAMEPORT1,(ciapra+_ciaa) ;FIRE
bne .down\@
.up\@ bsr .wait\@ ;entprellen
btst #CIAB_GAMEPORT0,(ciapra+_ciaa) ;LMB
beq .up\@
btst #POTGOB_DATLY-8,(potinp,a0) ;RMB
beq .up\@
btst #CIAB_GAMEPORT1,(ciapra+_ciaa) ;FIRE
beq .up\@
bsr .wait\@ ;entprellen
bra .done\@
.wait\@ waitvb a0
rts
.done\@ move.l (a7)+,a0
ELSE
IFEQ NARG-1
.down\@ bsr .wait\@
btst #CIAB_GAMEPORT0,(ciapra+_ciaa) ;LMB
beq .up\@
btst #POTGOB_DATLY-8,(potinp,\1) ;RMB
beq .up\@
btst #CIAB_GAMEPORT1,(ciapra+_ciaa) ;FIRE
bne .down\@
.up\@ bsr .wait\@ ;entprellen
btst #CIAB_GAMEPORT0,(ciapra+_ciaa) ;LMB
beq .up\@
btst #POTGOB_DATLY-8,(potinp,\1) ;RMB
beq .up\@
btst #CIAB_GAMEPORT1,(ciapra+_ciaa) ;FIRE
beq .up\@
bsr .wait\@ ;entprellen
bra .done\@
.wait\@ waitvb \1
rts
.done\@
ELSE
FAIL arguments "waitbutton"
ENDC
ENDC
ENDM
waitbuttonup MACRO
IFEQ NARG
move.l a0,-(a7)
lea (_custom),a0
.up\@ bsr .wait\@ ;entprellen
btst #CIAB_GAMEPORT0,(ciapra+_ciaa) ;LMB
beq .up\@
btst #POTGOB_DATLY-8,(potinp,a0) ;RMB
beq .up\@
btst #CIAB_GAMEPORT1,(ciapra+_ciaa) ;FIRE
beq .up\@
bsr .wait\@ ;entprellen
bra .done\@
.wait\@ waitvb a0
rts
.done\@ move.l (a7)+,a0
ELSE
IFEQ NARG-1
.up\@ waitvb \1 ;entprellen
btst #CIAB_GAMEPORT0,(ciapra+_ciaa) ;LMB
beq .up\@
btst #POTGOB_DATLY-8,(potinp,\1) ;RMB
beq .up\@
btst #CIAB_GAMEPORT1,(ciapra+_ciaa) ;FIRE
beq .up\@
waitvb \1 ;entprellen
ELSE
FAIL arguments "waitbuttonup"
ENDC
ENDC
ENDM
****************************************************************
***** flash the screen and wait for LMB
blitz MACRO
move #$1200,bplcon0+_custom
; move #DMAF_SETCLR|DMAF_RASTER,dmacon+_custom
move.l d0,-(a7)
.lpbl\@ move.w d0,$dff180
subq.w #1,d0
btst #6,$bfe001
bne .lpbl\@
waitvb ;entprellen
.lp2bl\@ move.w d0,$dff180
subq.w #1,d0
btst #6,$bfe001
beq .lp2bl\@
clr.w $dff180
move.l (a7)+,d0
ENDM
****************************************************************
***** install Vertical-Blank-Interrupt which quits on LMB pressed
QUITVBI MACRO
move.l a0,-(a7)
lea .vbi,a0
move.l a0,$6c
bra .g
.vbi btst #6,$bfe001
beq .vbi+1 ;create "address error"
move.w #INTF_VERTB,_custom+intreq
rte
.g move.w #INTF_SETCLR|INTF_INTEN|INTF_VERTB,_custom+intena
move.w #INTF_VERTB,_custom+intreq
move.l (a7)+,a0
ENDM
****************************************************************
***** set all registers to zero
resetregs MACRO
moveq #0,d0
moveq #0,d1
moveq #0,d2
moveq #0,d3
moveq #0,d4
moveq #0,d5
moveq #0,d6
moveq #0,d7
sub.l a0,a0
sub.l a1,a1
sub.l a2,a2
sub.l a3,a3
sub.l a4,a4
sub.l a5,a5
sub.l a6,a6
ENDM
;=============================================================================
; return-values for termination (resload_Abort)
;=============================================================================
TDREASON_OK = -1 ;normal termination
TDREASON_DOSREAD = 1 ;error with resload_ReadFile
;primary = dos errorcode
;secondary = file name
TDREASON_DOSWRITE = 2 ;error with resload_SaveFile/resload_SaveFileOffset
;primary = dos errorcode
;secondary = file name
TDREASON_DEBUG = 5 ;make coredump and quit
;primary = PC
;secondary = SR
TDREASON_DOSLIST = 6 ;error with resload_ListFiles
;primary = dos errorcode
;secondary = directory name
TDREASON_DISKLOAD = 7 ;error with resload_DiskLoad
;primary = dos errorcode
;secondary = disk number
TDREASON_DISKLOADDEV = 8 ;error with resload_DiskLoadDev
;primary = trackdisk errorcode
TDREASON_WRONGVER = 9 ;an version check (e.g. crc16) has detected an
;unsupported version of data files
TDREASON_OSEMUFAIL = 10 ;error in the OS emulation module
;primary = subsystem (e.g. "exec.library")
;secondary = error number (e.g. #_LVOAllocMem)
; version 7
TDREASON_REQ68020 = 11 ;Slave/installed program requires 68020
TDREASON_REQAGA = 12 ;Slave/installed program requires AGA Chip Set
TDREASON_MUSTNTSC = 13 ;installed program needs NTSC to run
TDREASON_MUSTPAL = 14 ;installed program